package com.core.sdk.ui.dialog;

import android.app.AlertDialog;
import android.content.Context;
import android.content.DialogInterface;

import com.core.sdk.utils.IntentUtil;

public class LightNetWorkSetDialog extends AlertDialog {

	public static AlertDialog create(final Context context, String title, String message) {
		AlertDialog networkDialog = LightAlertDialog.create(context);
		networkDialog.setTitle(title);
		networkDialog.setMessage(message);
		networkDialog.setCancelable(false);
		networkDialog.setButton("设置网络", new DialogInterface.OnClickListener() {
			@Override
			public void onClick(DialogInterface dialog, int which) {
				context.startActivity(IntentUtil.createNetworkSettingIntent());
			}
		});
		networkDialog.setButton2("取消", new DialogInterface.OnClickListener() {
			@Override
			public void onClick(DialogInterface dialog, int which) {
				dialog.dismiss();
			}
		});
		return networkDialog;
	}
	
	public static AlertDialog create(final Context context, String title, String message,DialogInterface.OnClickListener retryListener) {
		AlertDialog networkDialog = LightAlertDialog.create(context);
		networkDialog.setTitle(title);
		networkDialog.setMessage(message);
		networkDialog.setCancelable(false);
		networkDialog.setButton("设置网络", new DialogInterface.OnClickListener() {
			@Override
			public void onClick(DialogInterface dialog, int which) {
				context.startActivity(IntentUtil.createNetworkSettingIntent());
			}
		});
		networkDialog.setButton2("重试",retryListener);
		networkDialog.setButton3("取消", new DialogInterface.OnClickListener() {
			@Override
			public void onClick(DialogInterface dialog, int which) {
				dialog.dismiss();
			}
		});
		return networkDialog;
	}

	private LightNetWorkSetDialog(Context context, CharSequence message) {
		super(context, THEME_HOLO_LIGHT);
	}

}
